<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>钩子函数</title>
    <script src="node_modules/vue/dist/vue.min.js"></script>
</head>
<body>
<div id="app">
    {{ msg }}
</div>
<script type="text/javascript">
    const app = new Vue({
        el: "#app",
        data: {
            msg: ""
        },
        //钩子函数
        //注意:钩子函数会在vue实例的各个生命周期阶段自动调用
        //比如:beforeCreate,created,beforeMount,mounted,updated,beforeUpdate,destroyed,beforeDestroy
        created() {
            this.msg = "hello vue. created";
            //this就是vue实例对象
            console.log(this);
        }
    });
</script>
</body>
</html>